﻿using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UtilsCache;
using UtilsORM;
using UtilsORM.MySqlData;

namespace ServiceWeb.DBGateway
{
    public class DBIotDeviceVariableValueRlueCache
    {
        public DBIotDeviceVariableValueRlueCache()
        {

        }
        EFYihongIotContext ef = new EFYihongIotContext();

        /// <summary>
        /// 缓存增加 获取变量可操作条件
        /// </summary>
        /// <param name="cguid"></param>
        /// <returns></returns>
        public List<iot_device_model_variable_value_rlue> getVariableValueRlueListByCache()
        {
            List<iot_device_model_variable_value_rlue> list = UtilMemoryCacheHelper.StringGet<List<iot_device_model_variable_value_rlue>>("VariableValueRlueList");
            if (list == null)
            {
                list = ef.iot_device_model_variable_value_rlue.Where(c => c.vr_status == 0).ToList();
                UtilMemoryCacheHelper.StringSet("VariableValueRlueList", list, 1);
            }
            return list;
        }

    }
}
